package nuovoLogin;

import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;

public class AccessoCome extends JFrame implements ActionListener {
  JDialog frame;

  private JButton st=new JButton("STUDENTE");
  private JButton doc=new JButton("DOCENTE");
  private JButton amm=new JButton("AMMINISTRATORE");
 public AccessoCome(){
	 frame=new JDialog();
	 frame.setVisible(true);
	 frame.setLocation(500,250);
	 frame.setSize(400,200);
	 //panel
	 JPanel panel=new JPanel();
	  panel.setSize(new Dimension(400,200));
      panel.setMaximumSize(new Dimension(400,200));
      panel.setMinimumSize(new Dimension(400,200));
      panel.setPreferredSize(new Dimension(400,200));
      panel.setLayout(null);
    

   
	 //button:
	 //st
	 st.setBounds(50, 50, 100, 30);
	 st.setBorder(null);
     st.addActionListener( this);
     st.setFont(new Font("Georgia",Font.TRUETYPE_FONT,16));
     st.setForeground(new java.awt.Color(14,5,100));
   //doc
   doc.setBounds(250, 50,100, 30);
   doc.setBorder(null);
   doc.addActionListener( this);
   doc.setFont(new Font("Georgia",Font.TRUETYPE_FONT,16));
   doc.setForeground(new java.awt.Color(14,5,100));
   //amm
   amm.setBounds(100,110, 200, 30);
   amm.setBorder(null);
   amm.addActionListener( this);
   amm.setFont(new Font("Georgia",Font.TRUETYPE_FONT,16));
   amm.setForeground(new java.awt.Color(14,5,100));
	 panel.add(st);
	 panel.add(doc);
	 panel.add(amm);
	
	 frame.add(panel);
	      frame.setResizable(false);
	      frame.pack();
	      frame.setVisible(true);
	  frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
	 
	 
 }
 public static void main(String[]args){
	 AccessoCome a=new AccessoCome();
 }
@Override
public void actionPerformed(ActionEvent e) {
	
	if(e.getSource()==st){
		SwingUtilities.invokeLater(new Runnable() {

			@Override
			public void run() {
				AccessoStudente s = new AccessoStudente();
				s.setLocationRelativeTo(null);
				
				
			}
		});
	}// if studente
	if(e.getSource()==doc){
		SwingUtilities.invokeLater(new Runnable(){
			public void run(){
			AccessoDocente d=new AccessoDocente();
			d.setLocationRelativeTo(null);
			
			}
		});
	}// if docente
	if (e.getSource()==amm){
		SwingUtilities.invokeLater(new Runnable(){
			public void run(){
				AccessoAdm am =new AccessoAdm();
				am.setLocationRelativeTo(null);
				
			}
		});
	}//if amministratore
		

}
}
